/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI.Screens;

import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.TextField;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.layout.AnchorPane;

/**
 *
 * @author MITM
 */
public class Fxml_PurchaseOrderController implements Initializable {
    @FXML //  fx:id="ap_root"
    private AnchorPane ap_root; // Value injected by FXMLLoader

    @FXML //  fx:id="tf_buscar"
    private TextField tf_buscar; // Value injected by FXMLLoader

    private static int tipoOperacion;    
    /**
     * Initializes the controller class.
     * @param fxmlFileLocation
     * @param resources
     */     
    @Override // This method is called by the FXMLLoader when initialization is complete
    public void initialize(URL fxmlFileLocation, ResourceBundle resources) {
        assert ap_root != null : "fx:id=\"ap_root\" was not injected: check your FXML file 'Fxml_Measure.fxml'.";
        assert tf_buscar != null : "fx:id=\"tf_buscar\" was not injected: check your FXML file 'Fxml_Measure.fxml'.";

        //
        tf_buscar.setVisible(false);
        EventHandler eh = new EventHandler<KeyEvent>(){
            @Override
            public void handle(KeyEvent ke){
                if (ke.getCode().equals(KeyCode.ENTER) || ke.getCode().equals(KeyCode.TAB)){     
                    //
//                    loadTable( Ln.getInstance().findUser(tf_buscar.getText()));
                    tf_buscar.setVisible(false);
                }
            }
        };
        
        tf_buscar.setOnKeyPressed(eh);
        tipoOperacion = 0;  

    }    
        
}
